TK!2
=v
=u
=l
#1
:n
action_AAA
:v
E
#2
:n
action_ZZZ
:v
E
#3
:n
A
:c
master list
:v
'A1
'A2
'A3
'A4
'A5
'A6
'A7
'A8
E
#4
:n
A1
:c
subordinate list
:v
1
2
3
4
5
6
7
8
E
#5
:n
A2
:c
     "       "
:v
2
4
6
8
10
12
14
16
E
#6
:n
A3
:c
     "       "
:v
3
6
9
12
15
18
21
24
E
#7
:n
A4
:c
     "       "
:v
4
8
12
16
20
24
28
32
E
#8
:n
A5
:c
     "       "
:v
5
10
15
20
25
30
35
40
E
#9
:n
A6
:c
     "       "
:v
6
12
18
24
30
36
42
48
E
#10
:n
A7
:c
     "       "
:v
7
14
21
28
35
42
49
56
E
#11
:n
A8
:c
     "       "
:v
8
16
24
32
40
48
56
64
E
#12
:n
Z
:c
master list
:v
'Z1
'Z2
'Z3
'Z4
'Z5
'Z6
'Z7
'Z8
E
#13
:n
Z1
:v
E
#14
:n
Z2
:v
E
#15
:n
Z3
:v
E
#16
:n
Z4
:v
E
#17
:n
Z5
:v
E
#18
:n
Z6
:v
E
#19
:n
Z7
:v
E
#20
:n
Z8
:v
E
=f
#1
:n
Mcopy
:c
Copy matrix (i.e. subordinate lists)
:t
Procedure
:i
M1,M2
#2
:n
Mblank
:c
Blank matrix (i.e. subordinate lists)
:t
Procedure
:i
M
#3
:n
Mdelete
:c
Delete matrix (i.e. subordinate lists)
:t
Procedure
:i
M
#4
:n
play
:c
Sequence of Mcopy, Mblank and Mdelete calls
:t
Procedure
#1
:n
Mcopy
:z
" The procedure copies subordinate lists of the masterlist M1 into 
" subordinate lists of the master list M2.

for i=1 to length(M1)
   call listcopy(M1[i],M2[i])   " error indicates no listname in ith
                                " element of either M1 or M2
next i
/E
E
#2
:n
Mblank
:z
" The procedure blanks (i.e. erases the contents) of the subordinate lists
" named in the master list  M .

for i=1 to length(M)
   call blank(M[i])    " error indicates no listname in ith element of M
next i
/E
E
#3
:n
Mdelete
:z
" The procedure deletes subordinate lists of the master list  M  from the
" List Sheet. The master list remains intact.

for i=1 to length(M)
   call delete(M[i])    " error indicates no listname in ith element of M
next i
/E
E
#4
:n
play
:z
start:
  'action_ZZZ[1]:= 'copying_A_to_Z
  call Mcopy('A,'Z)
  call blank('action_ZZZ,1)

  'action_AAA[1]:= 'blanking_A
  call Mblank('A)

  'action_AAA[1]:= 'copying_Z_to_A
  call Mcopy('Z,'A)
  call blank('action_AAA,1)

  'action_ZZZ[1]:= 'deleting_Z
  call Mdelete('Z)
goto start
/E
E
=r
#1
:r
" ***  Copying, blanking and deleting matrices  ***
:s
C
#3
:r
" This model demonstrates the TK Library functions Mcopy (matrix copy),
:s
C
#4
:r
" Mblank (matrix blank) and Mdelete (matrix delete).  All these functions
:s
C
#5
:r
" act on matrices represented by lists of lists of matrix coefficients
:s
C
#6
:r
" (matrix rows or matrix columns).
:s
C
#8
:r
" Example: The matrix  A  in this model is represented by a master list  A
:s
C
#9
:r
" containing the names of subordinate lists expressed as symbolic values 'A1,
:s
C
#10
:r
" 'A2, ... .  Each of the subordinate lists contains a row or a column of
:s
C
#11
:r
" matrix elements (the matrix  A  is an  8 x 8  times table).
:s
C
#13
:r
" An "endless" sequence of matrix copy, blank and delete actions is
:s
C
#14
:r
" programmed in the procedure function  play  (press  = F [End] >  and
:s
C
#15
:r
" examine the Function Subsheet).  To see it in operation bring up the
:s
C
#16
:r
" interactive tables  AAA  and  ZZZ  in the upper and lower windows 
:s
C
#17
:r
" respectively with the command string  = T > > / W T [DownArrow] > > .  Next,
:s
C
#18
:r
" invoke the examine command by pressing  / E E ,  and enter  call play() .
:s
C
#20
:r
" You will see a lot of action.  A message displayed in the upper right
:s
C
#21
:r
" cell of each table will tell you what is going on at any moment.  You will
:s
C
#22
:r
" have to press  Ctrl-Break  to break the endless loop in the function play .
:s
C
#23
:r
" Try to do it when the upper table is filled so that you can start again by
:s
C
#24
:r
" another 'call play()'.  If you lose part of the matrix  A , you will have
:s
C
#25
:r
" to load the original model again.
:s
C
#27
:r
" There is a difference between  Mblank  and  Mdelete .  The former just
:s
C
#28
:r
" blanks the subordinate lists, whereas the latter deletes them completely.
:s
C
#29
:r
" You can see the difference if you 'call play()' when in the List Sheet.
:s
C
#30
:r
" The Elements field of the subordinate lists of the matrix  A  will be
:s
C
#31
:r
" alternately blanked and filled as the matrix is blanked and copied.  The
:s
C
#32
:r
" subordinate lists of the matrix  Z  will alternately disappear (when the
:s
C
#33
:r
" matrix is deleted) and reappear (when  A  is copied into it).
:s
C
=p
=t
#1
:n
AAA
:s
Screen
:v
Vertical
:f
1
:r
""
:c
""
:t
""
:u
#1
:l
A1
:w
6
:h
""
#2
:l
A2
:w
6
:h
""
#3
:l
A3
:w
6
:h
""
#4
:l
A4
:w
6
:h
""
#5
:l
A5
:w
6
:h
""
#6
:l
A6
:w
6
:h
""
#7
:l
A7
:w
6
:h
""
#8
:l
A8
:w
6
:h
""
#9
:l
action_AAA
:w
15
:h
""
E
#2
:n
ZZZ
:s
Screen
:v
Vertical
:f
1
:r
""
:c
""
:t
""
:u
#1
:l
Z1
:w
6
:h
""
#2
:l
Z2
:w
6
:h
""
#3
:l
Z3
:w
6
:h
""
#4
:l
Z4
:w
6
:h
""
#5
:l
Z5
:w
6
:h
""
#6
:l
Z6
:w
6
:h
""
#7
:l
Z7
:w
6
:h
""
#8
:l
Z8
:w
6
:h
""
#9
:l
action_ZZZ
:w
15
:h
""
E
=n
#1
:n
ttable
:d
15
:f

:^
Decimal
:e
"."
:m
""
:p
None
:j
Right
:s
- Only
:q
0
:x
2
:l
""
:t
""
:v
"0  "
=g
#1
:c
.000001
:i
10
:v
Yes
:g
ttable
:l
60
:f
66
:m
0
:w
80
:b
Yes
:a
Yes
:r
Yes
:h
No
:t
1
:n
Yes
:d
LPT1
%Tr,f,0,1,0,1,0
